<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://cdn.staticfile.org/vue/3.0.5/vue.global.js"></script>
    <title>Document</title>
    <style>
        .red {
            color: red;
        }
        .blue{
            color: blue;
        }
    </style>
</head>

<body>

    <div id="app">

    </div>
    <template id="main">
        <div style="color: red;">
            {{main}}
            <firstvue></firstvue>

        </div>
    </template>
    <template id="first">
        <div style="color: blue;">
            {{first}}
            <twovue :twoname="firstvalue" 
                    :twoname1="firstvalue1" 
                    :towname2="firstvaluecolor"
                    v-bind="obj"></twovue>
        </div>
    </template>
    <template id="two">
        <div :class="towname2">
            {{two}}  <br>
            ---- {{twoname}} <br>
            ---- {{twoname1}}<br>
           <div :class="blue1">---- {{red1}}  </div>
        </div>
    </template>
</body>

<script>

    let twoconfig = {
        template: '#two',
        //props属性传入一个数组时，每个字符参数代表接收一个一个属性
        // props: ['twoname', 'twoname1', 'towname2']
        // 'blue1','red1' 为对象拆分过来的属性

        props: ['twoname', 'twoname1', 'towname2','blue1','red1'],
        data() {
            return {
                two: 'two info'
            }
        }
    };

    let firstconfig = {
        template: '#first',
        data() {
            return {
                firstvalue: '我是first的信息',
                firstvalue1: '我是first的信息1',
                firstvaluecolor: 'red',
                first: 'first info',
                //props传入对象可使用v-bind将对象中每个属性拆出来逐一绑定(可以单独绑定对象中一个或者多个或者所有值。)
                obj:{
                    blue1:'blue',
                    red1:'red'
                }
            }
        },
        components: {
            twovue: twoconfig
        }
    };

    let mainconfig = {
        template: '#main',
        data() {
            return {
                main: 'main info'
            }
        },
        components: {
            firstvue: firstconfig
        }
    };

    Vue.createApp(mainconfig).mount("#app");
    // Vue.createApp(firstconfig).mount("#app");
    // Vue.createApp(twoconfig).mount("#app");

</script>

</html>